Part 33: Engineer's Corner #5: Shen-gen I/O
Engineer's Corner #5: Shen-gen I/OYou might have noticed I had the opportunity to use gen in both chips in the previous assignment, and only did it in the second one. There's a reason for this.
I did some testing. One gen is equivalent to a sequence of four mov and slp instructions, in every way, including how much power is used (4)... almost.
The catch is that gen draws a bit more of its power up front, consuming 2 power on the ticks it starts and stops the pulse (because it's doing the effect of mov and getting itself into slp mode on the same tick). By comparison, the sequence of mov/slp instructions spreads its power draw out over four ticks, one for each instruction.
This shouldn't affect power usage in the long run when a device is out in the world, but my simulator will sometimes end tests whenever it feels like - so designs that use gen may get a higher average power score compared to ones that use mov/slp for the same thing!
I know it's foolish, but I enjoy chasing the numbers if I have the opportunity (and the free space to use mov/slp instead of gen).
By the way - now that I have @ to work with, I'm able to answer a question someone asked me a long time ago...
RichardA posted:
Also in the Infrared Sensor it might be possible to fit in a slp acc with acc being the time until the sensor is armed instead of looping and checking each time-step.
I cooked up a new design that does just this:
Compared to my best design originally (¥6 / 358 avg power) this is ¥8 / 300 avg power. Most of the big MC's script:
1. Calculates how long until first 'on' time and sleeps that long. (This design assumes it is initially started during when the sensor is supposed to be 'off'.)
2. At the 'on' time, calculates how many time units the sensor needs to stay on out of the 96-time-unit cycle the real time clock uses.
3. Pushes that value to the small MC.
4. Waits 24 hours (96 time units), then repeats from Step 3. (The @s keep Steps 1 and 2 from reoccurring - and the 'teq dat 0' line is there to force the conditional flag to +, so that the two 'add 96' lines are disabled in addition to all the @ lines.)
The small MC takes the value (how long to stay on) from the big MC, and runs the sensor/alarm for that many time units, then goes to sleep to wait for the big MC to wake it up again.
Thanks for the inspiration, @RichardA!